/*     */ package DBstep;
/*     */ 
/*     */ import com.jcrj.util.DBConfig;
/*     */ import java.io.PrintStream;
/*     */ import java.sql.Connection;
/*     */ import java.sql.Date;
/*     */ import java.sql.DriverManager;
/*     */ import java.sql.ResultSet;
/*     */ import java.sql.Statement;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.Calendar;
/*     */ 
/*     */ public class iDBManager2000
/*     */ {
/*  13 */   public String ClassString = null;
/*  14 */   public String ConnectionString = null;
/*  15 */   public String UserName = null;
/*  16 */   public String PassWord = null;
/*     */   public Connection Conn;
/*     */   public Statement Stmt;
/*     */ 
/*     */   public iDBManager2000()
/*     */   {
/*  23 */     this.ClassString = DBConfig.getInstance().getProperty("oracle.driverClass");
/*  24 */     this.ConnectionString = DBConfig.getInstance().getProperty("oracle.jdbcUrl");
/*  25 */     this.UserName = DBConfig.getInstance().getProperty("oracle.user");
/*  26 */     this.PassWord = DBConfig.getInstance().getProperty("oracle.password");
/*     */   }
/*     */ 
/*     */   public boolean OpenConnection()
/*     */   {
/*  32 */     boolean mResult = true;
/*     */     try
/*     */     {
/*  35 */       Class.forName(this.ClassString);
/*  36 */       if ((this.UserName == null) && (this.PassWord == null))
/*     */       {
/*  38 */         this.Conn = DriverManager.getConnection(this.ConnectionString);
/*     */       }
/*     */       else
/*     */       {
/*  42 */         this.Conn = DriverManager.getConnection(this.ConnectionString, this.UserName, this.PassWord);
/*     */       }
/*     */ 
/*  45 */       this.Stmt = this.Conn.createStatement();
/*  46 */       mResult = true;
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/*  50 */       System.out.println(e.toString());
/*  51 */       mResult = false;
/*     */     }
/*  53 */     return mResult;
/*     */   }
/*     */ 
/*     */   public void CloseConnection()
/*     */   {
/*     */     try
/*     */     {
/*  61 */       this.Stmt.close();
/*  62 */       this.Conn.close();
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/*  66 */       System.out.println(e.toString());
/*     */     }
/*     */   }
/*     */ 
/*     */   public String GetDateTime() {
/*  71 */     Calendar cal = Calendar.getInstance();
/*  72 */     SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/*  73 */     String mDateTime = formatter.format(cal.getTime());
/*  74 */     return mDateTime;
/*     */   }
/*     */ 
/*     */   public Date GetDate()
/*     */   {
/*  80 */     Calendar cal = Calendar.getInstance();
/*  81 */     SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
/*  82 */     String mDateTime = formatter.format(cal.getTime());
/*  83 */     return Date.valueOf(mDateTime);
/*     */   }
/*     */ 
/*     */   public int GetMaxID(String vTableName, String vFieldName)
/*     */   {
/*  88 */     int mResult = 0;
/*  89 */     boolean mConn = true;
/*  90 */     String mSql = new String();
/*  91 */     mSql = "select max(" + vFieldName + ")+1 as MaxID from " + vTableName;
/*     */     try
/*     */     {
/*  94 */       if (this.Conn != null) {
/*  95 */         mConn = this.Conn.isClosed();
/*     */       }
/*  97 */       if (mConn) {
/*  98 */         OpenConnection();
/*     */       }
/*     */ 
/* 101 */       ResultSet result = ExecuteQuery(mSql);
/* 102 */       if (result.next())
/*     */       {
/* 104 */         mResult = result.getInt("MaxID");
/*     */       }
/* 106 */       result.close();
/*     */ 
/* 108 */       if (mConn)
/*     */       {
/* 110 */         CloseConnection();
/*     */       }
/*     */ 
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 116 */       System.out.println(e.toString());
/*     */     }
/* 118 */     return mResult;
/*     */   }
/*     */ 
/*     */   public ResultSet ExecuteQuery(String SqlString)
/*     */   {
/* 124 */     ResultSet result = null;
/*     */     try
/*     */     {
/* 127 */       result = this.Stmt.executeQuery(SqlString);
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 131 */       System.out.println(e.toString());
/*     */     }
/* 133 */     return result;
/*     */   }
/*     */ 
/*     */   public int ExecuteUpdate(String SqlString)
/*     */   {
/* 138 */     int result = 0;
/*     */     try
/*     */     {
/* 141 */       result = this.Stmt.executeUpdate(SqlString);
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 145 */       System.out.println(e.toString());
/*     */     }
/* 147 */     return result;
/*     */   }
/*     */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     DBstep.iDBManager2000
 * JD-Core Version:    0.6.0
 */